<?php

use Illuminate\Http\Request;
use Illuminate\Routing\Router;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::group([
    'namespace' => 'API',
    'middleware' => 'cors'
], function(Router $router) {
    $router->get('life-cycle-index','LifeCycle\\Index\\IndexController@index');
    $router->get('brand-index','LifeCycle\\Package\\BrandController@index');
    $router->get('package-index','LifeCycle\\Package\\PackageController@index');
    $router->get('package-detail','LifeCycle\\Package\\PackageController@detail');
    $router->get('package-settlement','LifeCycle\\Package\\PackageController@settlement');
    $router->post('user-login', 'Auth\\LoginController@login');
    $router->any('package-order-notify', 'LifeCycle\\Package\\OrderController@notify');
    $router->get('upload-token', 'UploadController@token');
    $router->post('send-sms', 'SmsController@sendSms');
    $router->post('verify-sms', 'SmsController@verifySms');
    $router->get('answer-survey', 'AnswerSurvey\\AnswerSurveyController@index');

    $router->group([
        'middleware' => 'auth:api',
    ], function (Router $router) {
        $router->get('user-car-info', 'LifeCycle\\User\\UserController@userCarInfo');
        $router->get('user-info', 'LifeCycle\\User\\UserController@userInfo');
        $router->post('save-user-info', 'LifeCycle\\User\\UserController@saveUserInfo');
        $router->get('package-user-order', 'LifeCycle\\Package\\OrderController@userOrder');
        $router->post('package-order-create', 'LifeCycle\\Package\\OrderController@create');
        $router->get('package-order-list', 'LifeCycle\\Package\\OrderController@orderList');
        $router->get('package-order-detail', 'LifeCycle\\Package\\OrderController@detail');
        $router->post('package-order-pay','LifeCycle\\Package\\OrderController@pay');
        $router->get('package-order-attr', 'LifeCycle\\Package\\OrderController@packageAttr');
        $router->get('car-all','LifeCycle\\Package\\CarController@memberAll');
        $router->get('package-used-list', 'LifeCycle\\Package\\UsedController@usedList');
        $router->get('package-used-detail', 'LifeCycle\\Package\\UsedController@detail');
        $router->get('package-operator-list', 'LifeCycle\\Package\\OperatorController@operatorList');
        $router->get('package-operator-detail', 'LifeCycle\\Package\\OperatorController@detail');
        $router->get('package-operator-edit-detail', 'LifeCycle\\Package\\OperatorController@editDetail');
        $router->get('operator-package-order', 'LifeCycle\\Package\\OperatorController@packageOrder');
        $router->post('package-operator-create', 'LifeCycle\\Package\\OperatorController@create');
        $router->post('package-operator-edit', 'LifeCycle\\Package\\OperatorController@edit');
        $router->get('package-order-agreement', 'LifeCycle\\Package\\OrderController@agreement');
        $router->post('package-order-agreement-save', 'LifeCycle\\Package\\OrderController@agreementSave');
        $router->get('package-order-agreement-detail', 'LifeCycle\\Package\\OrderController@agreementDetail');
        $router->get('store-all', 'LifeCycle\\Package\\DepartmentController@storeAll');
        $router->post('department-save', 'LifeCycle\\Package\\DepartmentController@save');
        $router->post('verify-user', 'LifeCycle\\User\\UserController@verifyOldUser');
        $router->post('answer-survey-create', 'AnswerSurvey\\AnswerSurveyController@create');
        $router->post('sheet-metal-create', 'LifeCycle\\Package\\OrderController@sheetMetalCreate');
    });
});


